$(document).on("click", "#login", function (event) {
    var phone = $("#phone").val();
    var password = $("#password").val();
    $.ajax({
        url : '/blog/login',
        contentType : 'application/json',
        type : 'post',
        cache : false,
        dataType : 'json',
        data:JSON.stringify({
            "phone" : phone,
            "password" : password
        }),
        success:function(data) {
            var token = data.token;
            var userInfo = data.ssoUserInfo;

            if(data.resultCode == 200 ){
                window.localStorage.setItem("token", token);
                window.localStorage.setItem("userInfo", JSON.stringify(userInfo));
                window.location.href = "../index.html";
            } else {
                alert("网络忙!");
            }
        },
        error : function() {
            console.log("error")
        }
    });
});


//    var uuid = generateUUID();
//    var baseUrl = '/login/getVerifyCode?uuid=' + uuid + '&';
//
//    $(document).ready(function(){
//        changeImgSrc(baseUrl);
//    });
//
//    function changeImgSrc(baseUrl) {
//        $("#verify_code").attr("src", baseUrl);
//    }
//
//    $(document).on("click","#verify_code",function(event){
//        var timestamp = (new Date()).valueOf();
//        var url = baseUrl + "random=" + timestamp;
//        changeImgSrc(url);
//
//    });